package com.xbongbong.parent.interfaces;

import com.xbongbong.paas.domain.entity.StageWorkLogEntity;
import com.xbongbong.paas.domain.entity.ext.PaasFormDataEntityExt;
import com.xbongbong.paas.toolbox.exception.XbbException;
import com.xbongbong.pro.businesstage.pojo.dto.CommonJumpDTO;
import com.xbongbong.pro.businesstage.pojo.dto.StageDetailDTO;
import com.xbongbong.pro.businesstage.pojo.dto.StageExecutionEventGetDTO;
import com.xbongbong.pro.businesstage.pojo.dto.StageExecutionEventSaveDTO;
import com.xbongbong.pro.businesstage.pojo.dto.StageFinishWorkDTO;
import com.xbongbong.pro.businesstage.pojo.dto.StageGetDTO;
import com.xbongbong.pro.businesstage.pojo.dto.StageJumpDealDTO;
import com.xbongbong.pro.businesstage.pojo.dto.StageJumpSpecialDealDTO;
import com.xbongbong.pro.businesstage.pojo.dto.StageJumpValidateDTO;
import com.xbongbong.pro.businesstage.pojo.dto.StartJumpDTO;
import com.xbongbong.pro.businesstage.pojo.vo.CommonJumpVO;
import com.xbongbong.pro.businesstage.pojo.vo.StageDetailVO;
import com.xbongbong.pro.businesstage.pojo.vo.StageExecutionEventGetVO;
import com.xbongbong.pro.businesstage.pojo.vo.StageExecutionEventSaveVO;
import com.xbongbong.pro.businesstage.pojo.vo.StageFinishWorkVO;
import com.xbongbong.pro.businesstage.pojo.vo.StageGetVO;
import com.xbongbong.pro.businesstage.pojo.vo.StartJumpVO;
import com.xbongbong.pro.weblist.pojo.dto.SaasBaseDTO;
import com.xbongbong.pro.workflow.enums.WorkflowExecutionTypeEnum;
import com.xbongbong.workflow.domain.entity.WorkflowExecutionEntity;
import com.xbongbong.workflow.domain.entity.WorkflowNodeEntity;

import java.util.List;
import java.util.Map;

/**
 * 详情页，阶段相关执行方法
 *
 * @author 吴峰
 * @date 2021/11/22 19:23
 */
public interface StageExecuteHandle {

    /**
     * 业务类型
     */
    Integer type();

    /**
     * 开始阶段阶段跳转
     */
    StartJumpVO startJump(StartJumpDTO startJumpDTO) throws XbbException;

    /**
     * description:  选中当前阶段
     * date: 2021/11/25 9:35 上午
     *
     * @Author yingjf
     */
    StageDetailVO detail(StageDetailDTO stagedetailDTO) throws XbbException;

    void validate(StageJumpValidateDTO stageJumpValidateDTO) throws XbbException;

    /**
     * description:  获取阶段条
     * date: 2021/11/25 9:34 上午
     *
     * @Author yingjf
     */
    StageGetVO get(StageGetDTO stageGetDTO) throws XbbException;

    /**
     * description: 完成任务/取消完成任务
     * date: 2021/11/25 9:34 上午
     *
     * @Author yingjf
     */
    StageFinishWorkVO finishWork(StageFinishWorkDTO stageFinishWorkDTO) throws XbbException;

    /**
     * description:  执行事件图片/附件 新增/更新接口
     * date: 2021/11/25 7:33 下午
     *
     * @Author yingjf
     */
    StageExecutionEventSaveVO executionEventSave(StageExecutionEventSaveDTO stageExecutionEventSaveDTO) throws XbbException;

    /**
     * description: 执行事件z字段编辑、关联数据表单获取
     * date: 2021/11/26 3:18 下午
     *
     * @Author yingjf
     */
    StageExecutionEventGetVO executionEventGet(StageExecutionEventGetDTO stageExecutionEventGetDTO) throws XbbException;

    /**
     * 校验开启阶段和高级权限
     */
    boolean checkshow(StageGetDTO stageGetDTO, PaasFormDataEntityExt paasFormDataEntityExt) throws XbbException;

    void stageWorkLogSave(StageWorkLogEntity stageWorkLogEntity) throws XbbException;

    List<StageWorkLogEntity> stageWorkLogFindEntitys(Map<String, Object> params) throws XbbException;

    /**
     * description:  校验阶段字段编辑权限
     * date: 2021/12/8 11:16 上午
     *
     * @Author yingjf
     */
    boolean checkFieldEditable(SaasBaseDTO saasBaseDTO) throws XbbException;

    /**
     * description:  阶段跳转after处理 用于日志消息处理
     * date: 2021/12/13 10:31 上午
     *
     * @Author yingjf
     */
    void afterJumpDeal(StageJumpDealDTO stageJumpDealDTO, PaasFormDataEntityExt paasFormDataEntityExt) throws XbbException;

    /**
     * description:  审批和工作流处理
     * date: 2021/12/14 2:47 下午
     *
     * @Author yingjf
     */
    Integer approvalRequired(CommonJumpDTO commonJumpDTO, PaasFormDataEntityExt paasFormDataEntityExt, String stageAttr) throws XbbException;

    /**
     * Description: 工作流发起处理
     * @param paasFormDataEntityExt
	 * @param startNode
	 * @param commonJumpDTO
	 * @param workflowExecutionTypeEnum
     * @param stageAttr
     * @param workflowExecutionEntity
     * @return void
     * @throws
     * @author 魏荣杰
     * @date 2022/2/15 09:44
     * @since
     */
    void workflowRequired(PaasFormDataEntityExt paasFormDataEntityExt, WorkflowNodeEntity startNode, CommonJumpDTO commonJumpDTO, WorkflowExecutionTypeEnum workflowExecutionTypeEnum, String stageAttr, WorkflowExecutionEntity workflowExecutionEntity) throws XbbException;

    /**
     * description:  阶段跳转特殊逻辑处理
     * date: 2021/12/16 4:21 下午
     *
     * @Author yingjf
     */
    void jumpSpecialDeal(StageJumpSpecialDealDTO stageJumpSpecialDealDTO) throws XbbException;

    CommonJumpVO stageCommonJump(CommonJumpDTO commonJumpDTO) throws XbbException;

}
